package com.codechuan.demo.common;

import android.annotation.SuppressLint;
import android.content.Context;
import android.media.MediaPlayer;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;

import com.alibaba.fastjson.JSONObject;
import com.codechuan.demo.dto.CityInfo;
import com.codechuan.demo.dto.SuccessOrder;
import com.codechuan.demo.dto.TokenObject;
import com.codechuan.demo.utils.ContextUtils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;


/**
 * @Deprecated 常量类
 */
@SuppressLint("SimpleDateFormat")
public class Constant {
    public static final String HOST = "103.36.167.125:81";
    public static  boolean CHECK_OK = false;
    public static String USER_PWD;

    public static String app_version = "79";
    public static boolean is_zx = false;

    public static String dept;

    public static boolean isStart = false;
    // 抢单按钮
    public static Button button = null;
    public static TextView errorMsg = null;
    // 上下文
    public static Context context = null;

    // 主号token
    public static String MAIN_TOKEN;
    // 主号ticket
    public static String MAIN_TICKET;
    // 主号失败次数
    public static Integer MAIN_ERROR_NUMBER = 0;
    // 主号状态
    public static String MAIN_ACCOUNT_STATUS = "主号正常";


    // 公告token集合
    public static ArrayList<TokenObject> SON_TOKENS = new ArrayList<>();
    // 小号token集合用于抢单时候回显作用,避免多次添加溢出问题
    public static ArrayList<TokenObject> SON_TOKENS_SHOW = new ArrayList<>();
    // 自己token集合
    public static ArrayList<TokenObject> MY_SON_TOKENS = new ArrayList<>();

    // 订单集合
    public static ArrayList<SuccessOrder> ORDER_LIST = new ArrayList<>();
    // 是否接单用的
    public static StringBuilder stringBuilder = new StringBuilder();

    public static String START_ADDRESS = "广东省深圳市宝安区";

    public static boolean CJ_ORDER = false; // 城际订单
    public static boolean SN_ORDER = false; // 市内订单
    public static boolean XC_ORDER = false; // 行程订单

    public static Integer MIN_MONEY = 100; // 最小金额
    public static Integer MAX_MONEY = 9999; // 最大金额

    public static Date START_TIME; // 工作接单开始时间
    public static String START_TIME_STRING = ""; // 工作接单开始时间字符串
    public static Date END_TIME;// 工作接单结束时间
    public static String END_TIME_STRING = "";// 工作接单结束时间字符串

    public static boolean ZJ_DX = false; // 只接独享单
    public static boolean YD_GS = false; // 愿摊高速费
    public static boolean LX_QD = false; // 连续抢订单

    public static String MAX_STARTING_POINT_DISTANCE = "50"; // 最大起点距离
    public static String MAX_DESTINATION_DISTANCE = "1000"; // 最大重点距离
    public static  boolean ZD_FB_XC = false;


    // 拼车选择框和拼车最小人数和最大人数代码区
    public static boolean PC_PERSON_CHECKBOX = false;
    public static Integer PC_MIN_NUMBER = 3;
    public static Integer PC_MAX_NUMBER = 4;


    // 独享选择框和独享最小人数和最大人数代码区
    public static boolean DX_PERSON_CHECKBOX = false;
    public static Integer DX_MIN_NUMBER = 1;
    public static Integer DX_MAX_NUMBER = 4;

    // 舒适选择框和舒适最小人数和最大人数代码区
    public static boolean SS_PERSON_CHECKBOX = false;
    public static Integer SS_MIN_NUMBER = 2;
    public static Integer SS_MAX_NUMBER = 4;

    // 最小单价选择框和最小单价金额
    public static boolean DJ_CHECK = false;
    public static Double DJ_MIN_MONEY = 1.5;


    // 发送验证码消息和返回数据
    public static String CODE_MSG = "发送成功";
    public static String CODE_MSG_Z = "发送中";
    public static String TOKEN_TQ_SUCCESS = "提取成功,请返回小号列表";
    public static String TOKEN_TQ = "提取中";

    public static JSONObject CODE_DATA = null;

    // 接单接口模式
    public static boolean APP_IS_CHECK = false;
    public static boolean XCX_IS_CHECK = false;

    // 刷新延时
    public static String SX_NUMBER = "500";


    // 是否定位
    public static boolean IS_DW = false;

    // 用户账号
    public static String USER_ACCOUNT;

    // 城市信息
    public static CityInfo cityInfo = null;

    // hallo版本信息
    public static String HALLO_VERSION = "6.76.5";
    public static String SDK_VERSION = "3.4.4";
    public static String RELEASE_VERSION = "6.63.0";
    public static String WECHAT_VERSION = "8.0.49";

    // 日志信息
    public static StringBuffer LOG_INFO = new StringBuffer();

    // 到期时间
    public static String DQ_TIME = "";

    // 获取订单类型
    public static String requestType; // 2市内 3城际
    public static String requestTypeParam;

    // 小程序订单接单使用的行程id
    public static String SCHEDULE_ID;

    // 解绑次数
    public static int U_BIND_NUMBER = 0;

    // 播放声音
    public static MediaPlayer mediaPlayer;

    // 订单排序规则
    public static boolean ZN_PX_CHECK = true;
    public static boolean ZZ_CHECK = false;
    public static boolean ZJ_CHECK = false;
    public static boolean ZG_CHECK = false;
    public static int SORT;

    // 主线程
    public static Handler handler;
    // 线程池
    public static ExecutorService executorService;

    // 小号状态hashmap 用来存储每个小号的异常数
    public static HashMap<String, Integer> MIN_ERROR_NUMBER = new HashMap<>();

    // 实时定位
    public static boolean SS_DW_CHECKED = false;

    // 查询订单类型
    public static String QUERY_ORDER_TYPE;

    // 实时定位选择框
    public static boolean startDwChecked = false;

    // 判断是否开启加入主号刷新
    public static boolean MAIN_SX;

    // 获取分辨率
    public static DisplayMetrics dm;

    // 行程订单参数
    public static String scheduleSld = "70";
    public static ArrayList<String> xc_id = new ArrayList<>();

    // 指定城市
    public static ArrayList<String> cityCodeList = new ArrayList<>();

    public static boolean ZD_CS_CHECK = false;
    public static String ZD_CS_TEXT = "例如:深圳市#佛山市";

    public static boolean PC_CS_CHECK = false;
    public static String PC_CS_TEXT = "例如:深圳市#佛山市";

    // 实时定位位置信息
    public static String SS_DW_INFO = "";
    public static String model;
    public static String phone_version;

    public static boolean isLogin = false;
    public static String deviceId;
    public static SimpleDateFormat format;

    // 自己当前已经pk成功的订单用于判断是否pk成功
    public static StringBuilder orderList = new StringBuilder();
    public static ArrayList<String> driverJourneyGuids = new ArrayList<>();
    public static boolean isTxm = false;

    // 获取悬浮窗权限
    public static int getStatusBarHeight() {
        int result = 0;
        int resourceId = ContextUtils.application.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result =  ContextUtils.application.getResources().getDimensionPixelSize(resourceId);
        }
        return result;
    }

    public static MediaPlayer mediaPlayerPK; // PK成功声音文件

    public static String[] IP_SERVER = {"http://27.25.159.222:20000/SlideApi/JySlide/all","http://115.231.220.57:20000/SlideApi/JySlide/all","http://115.231.218.243:19199/SlideApi/JySlide/all"};
    public static int NUMBER_BL = 0;

    public static String[] TXM_SERVER = {"http://27.25.159.222:6688/pub/Captcha","http://115.231.220.57:6688/pub/Captcha","http://115.231.218.243:6688/pub/Captcha"};



}
